package test.n00000;

public class Problem00080 {
    public static void main(String[] args) {
        println(123);
    }

    public static void println(final int x) {
        Solution ss = new Solution();
        System.out.println(x + "," + ss.isPalindrome(x));
    }

    public static class Solution {

        /**
         * 回文数, 顺序和逆序值相等
         *
         * @param x
         * @return
         */
        public boolean isPalindrome(int x) {
            if (x < 0) {
                return false;
            }
            if (x < 10) {
                return true;
            }
            char[] array = String.valueOf(x).toCharArray();

            int left = 0, right = array.length - 1;
            while(left < right) {
                if (array[left] != array[right]) {
                    return false;
                }
                left ++;
                right --;
            }
            return true;
        }
    }
}
